<template>
	<x-border title="智能助手" type="success" v-if="viewModel">
		<div class="admin-assistant">
			<div class="admin-assistant_left" v-if="false">
				<div class="assistant_left-crit">
					<el-progress type="circle" :percentage="80" :width="150" :stroke-width="17" color="#155bd4" :show-text="false"></el-progress>
					<div class="assistant_left-text">
						<span>8</span>项待处理
					</div>
				</div>
				<div class="assistant_left-but">去处理</div>
			</div>
			<div class="admin-assistant_right">
				<el-tabs v-model="activeName" type="border-card">
					<el-tab-pane :label="item.name" :name="JSON.stringify(index)" v-for="(item,index) in viewModel" :key="index">
						<itemStyle :widget="item.assistants"></itemStyle>
					</el-tab-pane>
				</el-tabs>
			</div>
			<div class="admin-assistant_qrcode">
				<div class="assistant_qrcode-li">
					<div class="assistant-flex">
						<x-qrcode :qrcodeUrl="qrcodeUrl" domId="qrcodeUrl"></x-qrcode>
					</div>
					<iframe :src="qrcodeUrl" width="260px" height="460px"></iframe>
				</div>
				<div class="assistant_qrcode-li">
					<div class="assistant-flex">
						<x-qrcode :qrcodeUrl="qrcodeUrl2" domId="qrcodeUrl2"></x-qrcode>
					</div>
					<iframe :src="qrcodeUrl2" width="260px" height="460px"></iframe>
				</div>
			</div>
		</div>
	</x-border>
</template>
<script>
	import itemStyle from './widget/item-style.vue'
	import ala from '@/service/ala'
	export default {
		components: {
			itemStyle
		},
		data() {
			return {
				activeName: '0',
				qrcodeUrl: '',
				qrcodeUrl2: '',
				viewModel: null
			}
		},
		mounted() {
			this.init()
		},
		methods: {
			async init() {
				this.qrcodeUrl = ala.host + 'pages/index'
				this.qrcodeUrl2 = ala.host + 'core/index'
				var repones = await this.$api.assistantList()
				this.viewModel = repones
			}
		}
	}
</script>
<style lang="scss">
	@import "./var.scss";
</style>